import {Ref, UnwrapRef} from "vue";
import request from "@/utils/request";
import {useUserStore} from "@/store/user";
import {Toast} from "vant";

export const uploadImage = async (file: any) => {
    const userStore = useUserStore();
    const formData = new FormData();
    formData.append('file', file);

        // 使用你封装的request工具
        return request.post('/img/upload', formData, {
            params: {
                id: userStore.id
            },
            headers: {
                'Content-Type': 'multipart/form-data'
            }
        });
};
